package com.ly.controller;

import com.ly.pojo.dto.CourseDTO;
import com.ly.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/course")
@CrossOrigin
public class CourseController {
    @Autowired
    private CourseService courseService;

    @GetMapping("/getAllCourse")
    public List<CourseDTO> getAllCourse() {
        return courseService.findAllCourse();
    }

    @GetMapping("/getCourseById/{id}")
    public CourseDTO getCourseById(@PathVariable("id") Integer courseId){
        return courseService.getCourseById(courseId);
    }

}
